/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import pojo.Donvi;
import java.util.*;
import org.hibernate.*;
import util.HibernateUtil;

/**
 *
 * @author Quan
 */
public class DonViDAO extends TableDAO {

    public DonViDAO() {
        hql_laydanhsach = "from Donvi";
        hql_lay = "from Donvi where id = :id";
    }

    public static List<Donvi> LayDanhSachDonVi() throws SessionException {
        java.util.List ds = null;
        SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
        Session session = sessionFactory.openSession();
        String hql = "from Donvi";
        try {
            org.hibernate.Query query = session.createQuery(hql);
            ds = query.list();
        } catch (SessionException e) {
            throw new SessionException(hql);
        } finally {
            session.close();
        }
        return ds;
    }
}
